1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import { withErrors, ok, apiError } from "@/lib/api";
import { requireUser } from "@/lib/auth";
import { getSource } from "@/lib/store";
import { ensureFresh } from "@/lib/refresh";
// POST /api/sources/:id/refresh โ force a fresh fetch now.
export const POST = withErrors(async (req, { params }) => {
await requireUser(req);
const { id } = await params;
const source = getSource(id);
if (!source) return apiError("not_found", "Source not found", 404);
const state = await ensureFresh(source, { force: true });
return ok({ source: state });
});
|